<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<head lang="en">
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>救援调度</title>
	<link rel="stylesheet" href="/lib/layui/layui/css/eleTree.css?2019101815.40">
	<link rel="stylesheet" href="/lib/layui/layui/css/treeTable.css?2019101815.17">
	<link rel="stylesheet" href="/lib/layui/layui/css/layui.css">
	<link rel="stylesheet" href="/lib/layui/layui/css/modules/layer/default/layer.css">
	<%--<link rel="stylesheet" href="../../lib/layui-v1.0.9_rls/layui/css/layui.css">--%>
	<link rel="stylesheet" href="/lib/layui/layui/css/layui.css">
	<script type="text/javascript" src="/lib/layui/layui/layui.js"></script>
	<script type="text/javascript" src="/lib/jquery-2.1.4.min.js"></script>
	<script type="text/javascript" src="/lib/layui/layui/layui.all.js"></script>
	<script type="text/javascript" src="/js/news/jquery-1.9.1.js"></script>
	<script src="/js/base/base.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript" src="/lib/layui/layui/global.js"></script>
	<script type="text/javascript" src="/lib/layui/layui/js/limstree.js?2019101815.47"></script>
	<script type="text/javascript" src="/lib/layui/layui/js/treeTable.js?2019101815.47"></script>

	<style>
		.layui-card-header{
			border-bottom: 1px solid #eee;
		}
		.mbox{
			padding: 8px;
		}
		.inbox{
			padding: 5px;
			padding-right: 30px;
		}
		.deptinput{
			display: inline-block;
			width: 75%;
		}
		.layui-btn{
			margin-left: 10px;
		}
		.layui-btn .layui-icon{
			margin-right: 0px;
		}
		.red{
			color: red;
			font-size: 16px;
		}
		.layui-form-label{
			padding: 8px 15px;
		}
		.layui-lf{
			min-width: 16%;
			overflow-x: auto;
			height:500px !important;
		}
		.layui-rt{
			width: 84%;
			margin-left: 6px;
			margin-top: -10px;
		}
		.treeTitle,.userTitle{
			display: inline-block;
			width: 47%;
			height: 30px;
			background-color: #00a0e9;
			color: #fff;
			text-align: center;
			line-height: 30px;
			cursor: pointer;
		}
		.group-query{
			color: #fff;
			text-align: center;
			background-color: #009688;
			height: 30px;
			width: 47%;
			display: inline-block;
			line-height: 30px;
			cursor: pointer;
		}
		.layui-nav-item,.layadmin-flexible{
			position: absolute;
			left: 5px;
			top: 23px;
			z-index: 9999999;
		}
		.rtfix{
			width: 17%;
			float: left;
		}
		.bg{
			background-color: #F2F2F2;
		}
		.bgs{
			background-color: #F2F2F2;
		}
		.back{
			background-color: #ccc;
		}
		.eleTree{
			cursor: pointer;
		}
		.layui-table-view .layui-table td, .layui-table-view .layui-table th{
			padding: 3px 0;
		}
		.layui-tab-title{
			height: 35px;
		}
		.layui-tab-title li{
			height: 36px;
			margin-top: -5px;
		}
		.layui-tab layui-tab-card{
			margin-top: -4px;
		}
		.layui-tab-card>.layui-tab-title .layui-this:after {
			border-width: 0px;
		}
		.baseinfo td{
			padding: 5px 2px;
		}
		.active{
			display: none;
		}
		.back{
			background-color: #F2F2F2;
		}
		.sele{
			width: 150px;
			height: 38px;
			line-height: 38px;
			background-color: #fff;
			border-radius: 2px;
			border: 1px solid #e6e6e6;
			padding-left: 5px;
		}
		.layui-form select{
			display: block;
		}
		.layui-laypage-limits select{
			height: 26px;
		}
		.people .layui-table-view{
			margin-bottom: 50px;
		}
		.layui-field-box {
			padding: 0px 0px 0px 15px;
		}
		.layui-table, .layui-table-view{
			margin:0px 10px
		}
		table{
			width:100%;
		}
		.fixRight{
			width:200px;
			/*height:300px;*/
			height: 408px;
			position: fixed;
			right:-200px;
			top:150px;
			background: #fff;
			z-index: 999999;
			/*overflow-y: scroll;*/
		}
		.fixBtn , .fixBtn1{
			width: 23px;
			/*height:300px;*/
			height: 408px;
			background: #009688;
			color:#fff;
			line-height: 300px;
			cursor: pointer;
			position: absolute;
			left: -23px;
		}
		.shebeiList li,.sbList li,.yjUserList li,.yjList li{
			line-height: 25px;
			text-align: center;
			border-bottom: 1px dashed #eee;
		}
		.shebeiList li:hover,.yjUserList li:hover{
			background: #eee;
			cursor:pointer;
		}
		.userLf{
			width: 17%;
			float: left;
		}
		table,tr{
			width:100%!important;
		}
		.layui-table-body{
			overflow: hidden;
		}
		/*.laytable-cell-1-0-6{*/
			/*margin:0px!important;*/
			/*padding:0px!important;*/
		/*}*/
		.layui-form-select{
			width: 265px;
		}
		/*.layui-anim, .layui-anim-upbit{*/
			/*height: 100px;*/
		/*}*/
        .big{
            font-size: 12pt;
            color: #124164;
            font-weight: bold;
        }
        .xq .layui-table{
            margin: 0px;
        }
        /*div[lay-id="Settlement"]  .layui-table-fixed{*/
            /*width: 6%;*/
        /*}*/
        div[lay-id="text"]  .layui-table-box  .layui-table-fixed-r{
            right: 5px !important;
        }
        /*div[lay-id="text"]  .layui-table-box  .layui-table-fixed-l{*/
            /*width: 7.3%;*/
        /*}*/
		.emergePerson  .layui-border-box .layui-table-box  .layui-table-fixed{
			width: 0px;
		}
		.tytab  .layui-border-box .layui-table-box  .layui-table-fixed{
			width: 0px;
		}
	</style>
</head>
<body>

<div class="mbox">
	<div class="fixRight">
		<div class="fixBtn"><span style="display: inline-block;line-height: 15px;padding: 0px 4px;">展开已选设备</span></div>
		<div class="fixBtn1" style="display: none"><span style="display: inline-block;line-height: 15px;padding: 0px 4px;">展开已选人员</span></div>
		<div style="width:100%;height:100%;overflow: auto">
			<div class="shebei">
				<div class="treeTitle" style="width: 100%;">已选设备</div>
				<%--<ul class="shebeiList" style="min-height: 100px"></ul>--%>
				<div class="shebeiList" style="min-height: 100px"></div>
			</div>
			<div class="yjUser" style="display: none">
				<div class="treeTitle" style="width: 100%;">已选人员</div>
				<div class="yjUserList" style="min-height: 100px"></div>
			</div>
		</div>

	</div>
	<div class="layui-tab" lay-filter="tab">
		<ul class="layui-tab-title">
			<li class="layui-this">应急设备</li>
			<li>应急人员</li>

		</ul>
		<div class="layui-tab-content">
			<div class="layui-tab-item layui-show">
				<div class="layui-card">
					<div class="layui-card-body" style="padding-left: 6px;    overflow: hidden;">
						<%--物资调度--%>
						<div style="width:100%">
							<fieldset class="layui-elem-field">
								<legend>应急设备</legend>
								<%--搜索--%>
								<form class="layui-form" action="" style="display: flex;">
									<div style="margin-left: 20%;">
										<button type="button" class="layui-btn layui-btn-sm showAllDevices" style="margin-top: 6px;">显示全部设备</button>
										<button type="button" class="layui-btn layui-btn-sm emergencyRescueEquipment" style="margin-top: 6px;">仅显示应急救援设备</button>
										<button type="button" class="layui-btn layui-btn-sm addEquipment" style="margin-top: 6px;">新增设备</button>
									</div>
									<div class="box" style="display: flex;float:right;margin-bottom:5px;">
										<label class="layui-form-label" style="padding: 8px 0px;">设备名称：</label>
										<div class="layui-input-block" style="width: 160px;margin-left: 0px">
											<input type="text" name="material" placeholder="请输入" autocomplete="off" class="layui-input wuInp" >
										</div>
										<label class="layui-form-label" style="padding: 8px 0px;width: 50px;">型号：</label>
										<div class="layui-input-block" style="width: 160px;margin-left: 0px">
											<input type="text" name="info" placeholder="请输入" autocomplete="off" class="layui-input wuInp" >
										</div>
										<div class="layui-input-block" style="width:184px;margin-left: 13px;margin-top:-5px;">
											<button type="button" class="layui-btn thingbtn" style="height: 30px;line-height: 30px;margin-top: 6px;width: 60px;">搜索</button>
											<button type="button" class="layui-btn save" style="height:30px; margin-top: 7px;width: 60px;">保存</button>
										</div>
									</div>
								</form>
								<div class="layui-lf rtfix layui-field-box" style="width:230px!important;">
									<div class="treeTitle" id="equip" dataType="0" >设备类别</div>
									<div class="group-query" id="groupss" dataType="0" >分组查询</div>
									<div class="panel-body tyid">
										<div class="eleTree ele1" lay-filter="data1"></div>
									</div>
									<div class="panel-body gros" style="display: none">
										<div class="eleTree ele2" lay-filter="data2"></div>
									</div>
								</div>
								<div style="float: left;width:calc(100% - 300px)" class="tytab">
									<table id="Settlement" lay-filter="SettlementFilter"></table>
								</div>
								<%--<div style="float: left;width:calc(100% - 300px)" class="grtab">
									<table id="Settlement1" lay-filter="SettlementFilter" style="display:none"></table>
								</div>--%>
							</fieldset>
						</div>
					</div>
				</div>

			</div>
			<div class="layui-tab-item">
				<div class="layui-card">
					<div class="layui-card-body" style="padding-left: 6px;    overflow: hidden;">
						<%--人员调度--%>
						<div style="position: relative">
							<fieldset class="layui-elem-field people" style="">
								<legend>应急人员</legend>
								<form class="layui-form " action="" style="display: flex">
									<div style="margin-left: 20%;">
										<button type="button" class="layui-btn layui-btn-sm showAllPeople" style="margin-top: 6px;">显示全部人员</button>
										<button type="button" class="layui-btn layui-btn-sm onlyEmergencyPerson" style="margin-top: 6px;">仅显示应急人员</button>
										<%--<button type="button" class="layui-btn layui-btn-sm addPerson" style="margin-top: 6px;">新增人员</button>--%>
									</div>
									<div class="box" style="display: flex;margin-left: 12%;float:right;margin-bottom:5px;">
										<div class="layui-input-block" style="width: 250px;margin-left: 27px">
											<input type="text" name="price_max" placeholder="请输入" autocomplete="off" class="layui-input personInp" >
										</div>
										<div class="layui-input-block" style="width: 193px;margin-left: 13px;">
											<button type="button" class="layui-btn peobtn"  style="height: 35px;line-height: 35px;margin-top: 2px;width: 70px;">搜索</button>
											<button type="button" class="layui-btn save2" style="height:35px;    margin-top: 0px;">保存</button>
										</div>
									</div>
								</form>
								<div class="width:100%;">
									<div class="layui-lf userLf layui-field-box" style=" width:220px!important; ">
										<div class="userTitle" id="userType" dataType="0" style="    width: 100%;">应急人员</div>
										<div class="panel-body tyid">
											<div class="eleTree ele2" lay-filter="data2"></div>
										</div>
									</div>
									<div style="float:left;width:calc(100% - 300px)" class="emergePerson">
										<table id="text" lay-filter="textFilter" style="margin-left: 0px;"></table>
									</div>

								</div>

							</fieldset>
						</div>
					</div>
				</div>

			</div>

		</div>
	</div>


</div>
<%--应急设备--%>
<script type="text/html" id="barDemo">
	<!-- 这里同样支持 laytpl 语法，如： -->
	{{#  if(d.crasId!==''||d.crasId!==undefined || d.crasId!==null){ }}
	<button  lay-event="edit" type="button" class="layui-btn layui-btn-xs" style="padding: 0px;width: 40px;line-height: 16px;height: 28px;margin-left:5px">调度</button>
	{{#  } }}
</script>
<%--应急人员--%>
<script type="text/html" id="barDemo1">
	<!-- 这里同样支持 laytpl 语法，如： -->
	{{#  if(d.crasId!==''||d.crasId!==undefined || d.crasId!==null){ }}
	<button  lay-event="edit" type="button" class="layui-btn layui-btn-xs" style="padding: 0px;width: 40px;line-height: 16px;height: 28px;margin-left:5px">调度</button>
	{{#  } }}
</script>

<script type="text/javascript">

    var paent=parent.jyuan
    var checktab=[]; //单选储存应急设备id数组
	var checktabName = [];
	var shebming=[] //储存应急设备-设备类别名称
    var table_data = new Array();//存放初始化加载的10条数据
    var peocheck=[];//单选存储应急人员id数组
    var peocheckName = [];
    var peo_data = new Array();//存放初始化加载的10条数据
	var shebeiList=''
    var yjUserList=''
    var shebeiNameList=''
    var yjUserNameList=''
	var flag1=true;
	var flag2 = true

    //展开已选设备
	$('.fixBtn').click(function(){
        $('.fixBtn1').hide()
	    if($(this).text()=='展开已选设备'){
	        $('.fixRight').animate({'right':'0px'})
            $(this).find('span').text('收缩已选设备')
		}else{
            $('.fixRight').animate({'right':'-200px'})
            $(this).find('span').text('展开已选设备')
		}
	})
    //展开已选人员
    $('.fixBtn1').click(function(){
        $('.fixBtn').hide()
        $('.fixBtn1').show()
        if($(this).text()=='展开已选人员'){
            $('.fixRight').animate({'right':'0px'})
            $(this).find('span').text('收缩已选人员')
        }else{
            $('.fixRight').animate({'right':'-200px'})
            $(this).find('span').text('展开已选人员')
        }
    })

    //已选设备列表
    $.ajax({
        url:'/crash/showDetails',
        data:{crasId:paent.crasId,type:2},
        dataType:'json',
        success:function(res){
        	// console.log(res.obj)
            if(res.obj.rescueEquipment!=''&&res.obj.rescueEquipment!=undefined){
                shebeiList = res.obj.rescueEquipment;
                if(shebeiList!=''){
                    checktab=shebeiList.split(',')
                }
                // var str=''
                // for(var i=0;i<res.obj.rescueEquipmentList.length;i++){
                //     str += '<li id="'+res.obj.rescueEquipmentList[i].id+'" typeName="'+res.obj.rescueEquipmentList[i].typeName+'">'+res.obj.rescueEquipmentList[i].typeName+'-'+res.obj.rescueEquipmentList[i].assetsName+'</li>'
                //     shebeiNameList+=res.obj.rescueEquipmentList[i].assetsName+','
                // }
				var ty=''
				// 把后台返的设备类别按逗号分开
				for(var i=0;i<res.obj.rescueEquipmentList.length;i++){
					 ty+=res.obj.rescueEquipmentList[i].typeName+','
                    checktabName.push(res.obj.rescueEquipmentList[i].assetsName)
				}
				// 把设备类别最后一个逗号截取
				var tyname=ty.substring(0,(ty.length-1)).split(',')

				// console.log(tyname)
				//去重后的设备类别数组
				var tyName=unique(tyname)
				//设备名称
				var shebeiName=''
				for(var i=0;i<tyName.length;i++){
					shebeiName+='<ul tyName="'+tyName[i]+'"><span>'+tyName[i]+':</span>' +
							function () {
								var str=''
								for(var j=0;j<res.obj.rescueEquipmentList.length;j++){
									//根据设备类别往对应的区域放
									if(tyName[i]==res.obj.rescueEquipmentList[j].typeName){
										str += '<li id="'+res.obj.rescueEquipmentList[j].id+'" typeName="'+res.obj.rescueEquipmentList[j].typeName+'">'+res.obj.rescueEquipmentList[j].assetsName+
												'<i id="shanchu" class="layui-icon layui-icon-close" style="font-size: 18px; color:red;margin-left: 6px;"></i>' +
												'</li>'

									}else{
										str +=''
									}
								}
								return  str
							}()+
							'\</ul>'
				}
				// console.log(tyName)
				$('.shebeiList').html(shebeiName)
				//渲染后取数量
				for(var i=0;i<tyName.length;i++){
					//获取回显后的数量
					var shuliang=$('.shebeiList ul[tyName="'+tyName[i]+'"]').find('li[typeName="'+tyName[i]+'"]').length
					var ss=$('.shebeiList ul[tyName="'+tyName[i]+'"]').find('span')
					// console.log($('.shebeiList ul[tyName="'+tyName[i]+'"]').find('span'))
					ss.append('<b>'+shuliang+'</b>')
				}
            }
        }
    })

	//已选人员
    $.ajax({
        url:'/crash/showDetails',
        data:{crasId:paent.crasId,type:1},
        dataType:'json',
        success:function(res){
            if(res.obj.rescuePersons!=''&&res.obj.rescuePersons!=undefined){
                yjUserList = res.obj.rescuePersons
                if(yjUserList!=''){
                    peocheck=yjUserList.split(',')
                }
                // var str=''
                // for(var i=0;i<res.obj.rescuePersonList.length;i++){
                //     str += '<li>'+res.obj.rescuePersonList[i].userName+'</li>'
                //     yjUserNameList += res.obj.rescuePersonList[i].userName+','
                // }
                // $('.yjUserList').html(str)

                var ty=''
                // 把后台返的职务按逗号分开
                for(var i=0;i<res.obj.rescuePersonList.length;i++){
                    ty+=res.obj.rescuePersonList[i].jobName+','
                    peocheckName.push(res.obj.rescuePersonList[i].userName)
                }
                // 把职务最后一个逗号截取
                var tyname=ty.substring(0,(ty.length-1)).split(',')
                // console.log(tyname)
                //去重后的设备类别数组
                var tyName=unique(tyname)
                //姓名
                var xName=''
                for(var i=0;i<tyName.length;i++){
                    xName+='<ul tyName="'+tyName[i]+'"><span>'+tyName[i]+':</span>' +
                        function () {
                            var str=''
                            for(var j=0;j<res.obj.rescuePersonList.length;j++){
                                //根据职务往对应的区域放
                                if(tyName[i]==res.obj.rescuePersonList[j].jobName){
                                    str += '<li id="'+res.obj.rescuePersonList[j].userId+'" typeName="'+res.obj.rescuePersonList[j].jobName+'">'+res.obj.rescuePersonList[j].userName+
                                        '<i id="shanchu1" class="layui-icon layui-icon-close" style="font-size: 18px; color:red;margin-left: 6px;"></i>' +
                                        '</li>'

                                }else{
                                    str +=''
                                }
                            }
                            return  str
                        }()+
                        '\</ul>'
                }
                // console.log(tyName)
                $('.yjUserList').html(xName)

                //渲染后取数量
                for(var i=0;i<tyName.length;i++){
                    //获取回显后的数量
                    var shuliang=$('.yjUserList ul[tyName="'+tyName[i]+'"]').find('li[typeName="'+tyName[i]+'"]').length
					// console.log(shuliang)
                    var ss=$('.yjUserList ul[tyName="'+tyName[i]+'"]').find('span')
                    // console.log($('.shebeiList ul[tyName="'+tyName[i]+'"]').find('span'))
                    ss.append('<b>'+shuliang+'</b>')
                }



			/*	if(res.obj.rescuePersons!=''&&res.obj.rescuePersons!=undefined){
                    var arr = res.obj.rescuePersons.split(',');
                    for(var j=0;j<arr.length;j++){
                        $('.yjUserList').find('li').eq(j).attr('id',arr[j])
					}
				}*/
            }
        }
    })

    layui.use(['table','layer','form','element','eleTree'], function(){
        var table = layui.table;
        var form = layui.form;
		var eleTree = layui.eleTree;
		var layer = layui.layer
        var rate = layui.rate;
		var element = layui.element;
        var $ = layui.jquery;
        var staffName
        $('.backs').click(function(){
            layer.closeAll();
        })
        element.on('tab(tab)', function(d){
            var index = d.index;
            if(index == 0){
                $('.shebei').show();
                $('.yjUser').hide()
                $('.fixBtn1').hide()
                $('.fixBtn').show()
			}else{
                $('.shebei').hide();
                $('.yjUser').show()
                $('.fixBtn').hide()
                $('.fixBtn1').show()
			}
        });
        //应急设备列表渲染
        var tableIns=table.render({
            elem: '#Settlement',
            url:'/crash/showAssets',
            cols: [[
                {type: 'checkbox', fixed: 'left',width:'5.5%'} //totalRowText:'合计'
                ,{field:'assetsName', title:'设备名称 ',width:'10%',templet:function(d){
						return  '<a  class="sbming" id="'+d.id+'" lay-event="detail">'+d.assetsName+'</a>'
					} }
                ,{field:'info', title:'型号 ',width:'10%'}
                ,{field:'number', title:'数量',width:'6.5%' }
                ,{field:'typeName', title:'设备类别',width:'9.5%'}
				,{field:'eventName', title:'所属项目',width:'10%'}
                ,{field:'deptName', title:'所属部门',width:'10%' }
                ,{field:'currutLocation', title:'所在位置',width:'10%'}
                ,{field:'status', title:'设备状况 ',width:'10%',templet:function(d){
                    if(d.status == '1'){
                        return '未使用'
					}else if(d.status == '2'){
                        return '使用'
					}else if(d.status == '3'){
                        return '损坏'
                    }else if(d.status == '4'){
                        return '丢失'
                    }else{
                        return '报废'
                    }
					} }
				,{fixed: 'right',title:'操作 ', width:'8%', align:'center', toolbar: '#barDemo'}
            ]],
            page: true,
            done:function (res) {

                table_data = res.data;//初始化数据;此处接收的是当前页的这10条数据
               	if(shebeiList!=''){
                    // var arr = shebeiList.split(',');
                    // var arrtwo = shebeiNameList.split(',')
                    // for (var m = 0; m < table_data.length; m++) {
                    //     for (var n = 0; n < arr.length; n++) {
                    //         if (table_data[m].id == arr[n]) {//匹配上就设为选中
                    //             if(flag1){
                    //                 checktab.push(arr[n])
                    //                 checktabName.push(table_data[m].assetsName)
					// 			}
                    //
                    //             //回显checkbox
                    //             $('div[lay-id="Settlement"] .layui-table tr[data-index=' + m + '] input[type="checkbox"]').attr("checked", "checked");
                    //             form.render('checkbox');
                    //
                    //         }
                    //     }
                    // }

                    for(var i=0;i<checktab.length;i++){
                        // $('div[lay-id="Settlement"] .layui-table .sbming[id="'+checktab[i]+'"]').parents('tr').find('input[type="checkbox"]').prop("checked", 'checked');
                        $('.tytab .layui-table .sbming[id="'+checktab[i]+'"]').parents('tr').find('input[type="checkbox"]').prop("checked", 'checked');
                        form.render('checkbox');
                    }
				}

                if (checktab.length > 0) {
                    for (var i = 0; i < checktab.length; i++) {
                        for (var j = 0; j < table_data.length; j++) {
                            if (checktab[i] == table_data[j].id) {//匹配上就设为选中
                                //回显checkbox
                                // $('div[lay-id="Settlement"] .layui-table tr[data-index=' + j + '] input[type="checkbox"]').attr("checked", "checked");
                                $('.tytab .layui-table tr[data-index=' + j + '] input[type="checkbox"]').attr("checked", "checked");
                                $('th').find('.layui-form-checkbox').remove();
                                form.render('checkbox');

                            }
                        }
                    }
                }
                if(res.msg=='无数据'){
                    $('.layui-table-page').hide()
                }
                setTimeout(function(){
                    $('th').find('.layui-form-checkbox').remove();
				},100)
                // $('.layui-table-header').find('th').eq(0).find('input[type="checkbox"]').remove()
                form.render();
                //点击右侧展开页面删除按钮x
                $(document).on("click", "#shanchu", function () {
                    if($(this).parent().parent().find('li').length==1){
                        $(this).parent().parent().remove()
                    }else{
                        $(this).parent().remove()
                    }
                    //取消时数量改变后重新赋值
                    var litypename=$(this).parent().attr("typename");
                    var ss=$('.shebeiList  ul[tyName="'+litypename+'"]').find('b');
                    var s=$('.shebeiList  ul[tyName="'+litypename+'"]').find('li').length;
                    ss.html(s);
                    var id = $(this).parent().attr('id');
                    console.log(id)
                    removeWithoutCopy(checktab,id)
                    // var index= $('div[lay-id="Settlement"] .layui-table .sbming[id="'+id+'"]').parents('tr').attr('data-index')
                    var index= $('.tytab .layui-table .sbming[id="'+id+'"]').parents('tr').attr('data-index')
                    $('tr[data-index=' + index + '] input[type="checkbox"]').prop('checked', false);
                    $('tr[data-index=' + index + '] input[type="checkbox"]').next().removeClass('layui-form-checked');
                    setTimeout(function(){
                        $('th').find('.layui-form-checkbox').remove();
                    },50)

                    form.render('checkbox')
                    // console.log(checktab)


                });


            }
        });
		//点击显示全部设备
		$('.showAllDevices').click(function(){
			tableIns.reload({
				url: '/crash/showAssets',
				where: { //设定异步数据接口的额外参数，任意设
					type:0
				},
			})
			// 初始化渲染 应急设备树形菜单
			el = eleTree.render({
				elem: '.ele1',
				showLine:true,
				url:'/cpAssetsType/showYjType',
				lazy: true,
				load: function(data,callback) {
					$.post('/cpAssetsType/showChild?parentId='+data.typeId,function (res) {
						callback(res.data);//点击节点回调
					})
				},
				done:function (data) { //渲染完成回调
					var aldata = data.data
					var name=data.data[0].name //传的是默认选中的值
					var pid = data.data[0].equipTypePid;
					// getTabke(data.data[0].id);
					var dataid=$('.ele1 div').attr("data-id")
					$('.eleTree-node').removeClass('back')
					$('.ele1 div[data-id='+dataid+']').addClass('back')
					$('.eleTree-node-group').css('background','#fff')
				}
			});
			// 节点点击事件设备
			var crasId
			eleTree.on("nodeClick(data1)",function(d) {
				crasId = d.data.currentData.typeId
				var dataid=$('.ele1 div').attr("data-id")
				var a = d.data.currentData.id;
				$('.eleTree-node').removeClass('back')
				$(d.node[0]).addClass('back')
				$('.eleTree-node-group').css('background','#fff')
				var obj = d.data.currentData
				var name = obj.name
				var pid = obj.equipTypePid;
				var idkey = obj.id;
				var currentPage = 1
				table.reload('Settlement',{
					url : '/crash/showAssets?type=0&typeId='+ obj.typeId,

				})

			});
		})
		//点击仅显示应急救援设备
		$('.emergencyRescueEquipment').click(function(){
			tableIns.reload({
				url: '/crash/showAssets',
				where: { //设定异步数据接口的额外参数，任意设
					type:1
				},
			})
			// 初始化渲染 应急设备树形菜单
			el = eleTree.render({
				elem: '.ele1',
				showLine:true,
				url:'/cpAssetsType/showYjType',
				lazy: true,
				load: function(data,callback) {
					$.post('/cpAssetsType/showChild?parentId='+data.typeId,function (res) {
						callback(res.data);//点击节点回调
					})
				},
				done:function (data) { //渲染完成回调
					var aldata = data.data
					var name=data.data[0].name //传的是默认选中的值
					var pid = data.data[0].equipTypePid;
					// getTabke(data.data[0].id);
					var dataid=$('.ele1 div').attr("data-id")
					$('.eleTree-node').removeClass('back')
					$('.ele1 div[data-id='+dataid+']').addClass('back')
					$('.eleTree-node-group').css('background','#fff')
				}
			});
			// 节点点击事件设备
			var crasId
			eleTree.on("nodeClick(data1)",function(d) {
				crasId = d.data.currentData.typeId
				var dataid=$('.ele1 div').attr("data-id")
				var a = d.data.currentData.id;
				$('.eleTree-node').removeClass('back')
				$(d.node[0]).addClass('back')
				$('.eleTree-node-group').css('background','#fff')
				var obj = d.data.currentData
				var name = obj.name
				var pid = obj.equipTypePid;
				var idkey = obj.id;
				var currentPage = 1
				table.reload('Settlement',{
					url : '/crash/showAssets?type=1&typeId='+ obj.typeId,

				})

			});

		})
		//应急设备工具条
		table.on('tool(SettlementFilter)', function(obj){ //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
			var data = obj.data; //获得当前行数据
			var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
			var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）
			console.log(data)
			var crasId=data.crasId
            var coverAssetId=data.id

			if(layEvent === 'edit'){
					layer.open({
						type: 1,
						btn:['确定','取消'],
						title: '调度',
						// area: ['850px', '400px'], //宽高
						area: ['750px', '350px'], //宽高
						content:'<form class="layui-form"> <div class="layui-form-item" style="margin-top:15px">\n' +
						'    <label class="layui-form-label" style="width: 89px;">被调度的资产:</label>\n' +
						'    <div class="layui-input-block">\n' +
						'      <div style="line-height: 35px;" class="zichan" id="'+data.id+'">'+data.assetsName+'</div>' +
						'    </div>\n' +
						'  </div>' +
						/*'<div class="layui-form-item">'+
						'<label class="layui-form-label" style="width: 107px;padding: 8px 0px;">被调度到的项目:</label>'+
						'<div class="layui-input-block">'+
						'<select class="shijian" name="shijian" lay-filter="shijian" style="display: none;">'+
						'</select>'+
						'</div>'+
						'</div>'+
                        '<div class="layui-form-item layui-form-text">'+
                        '<label class="layui-form-label">备注</label>'+
                        '<div class="layui-input-block" style="width: 720px;">'+
                        '<textarea name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>'+
                        '</div>'+
                        '</div>'+*/
						'<div class="layui-form-item">'+
                         '<label class="layui-form-label" style="width: 107px;padding: 8px 0px;">物品状态:</label>'+
                         '<div class="layui-input-block">'+
                         '<select id=\'status\'style="display: none;">'+
                        '</select>'+
                         '</div>'+
                            '</div>'+
                    "<div class='layuiDiv'>\n" +
                    " <span style='margin-left: 43px;'>保管人：<span style='color:red'>*</span></span>\n" +
                    "<textarea name=\"scheduler\" id=\"scheduler\" class=\"scheduler\" deptid=\"\" cols=\"22\" disabled readonly style='width:400px;'></textarea>" +
                    "<a href='javascript:;' class=\"addScheduler\" style=\"color:#207bd6;margin-left:5px;text-decoration:none\">添加</a>" +
                    "<a href=\"javascript:;\" class=\"clearScheduler\" style=\"color:#f00;margin-left:5px;text-decoration:none\">清空</a>" +
                    "</div>\n"+
                '</form>'
                ,success:function () {
                    form.render()
                    //选择被调度到的事件
                    $.ajax({
                        url: '/crash/showAll',
                        type: 'post',
                        dataType: 'json',
                        success:function (res) {
                            var data=res.data
                            var str=''
                            for(var i=0;i<data.length;i++){
                                str+=' <option value="'+data[i].crasId+'">'+data[i].eventName+'</option>'
                            }
                            $('.shijian').html(str)
                            form.render()
                        }
                    })
                    $(".addScheduler").on("click",function(){
                        user_id = "scheduler";
                        $.popWindow("../common/selectUser?0");
                    });
                    $(".clearScheduler").on("click",function(){
                        $("#scheduler").val("");
                        $("#scheduler").attr("dataid","");
                        $("#scheduler").attr("user_id","");
                        $("#scheduler").attr("userprivname","");
                    });
                    $('#status').append('<option value="1"><fmt:message code="event.th.notUsed" /></option>\n' +
                                '                        <option value="2"><fmt:message code="evvent.th.Use" /></option>\n' +
                                '                        <option value="3"><fmt:message code="event.th.damage" /></option>\n' +
                                '                        <option value="4"><fmt:message code="event.th.Lose" /></option>\n' +
                                '                        <option value="5"><fmt:message code="event.th.Scrap" /></option>');
						}
						,yes:function (index) {
							//保存  传被调度的资产、备注和被调度到的事件
							var  coverAssetId=$('.zichan').attr('id')   //被调度的资产
						/*	var dispRemark=$('textarea[name="desc"]').val()  //备注
							var coverCrasId=$('select[name="shijian"] :checked').val()  //被调度到的事件
							$.ajax({
								url: '/CpAssetDispatch/insertDispatch',
								type: 'post',
								dataType: 'json',
								data:{
									dispType:2,
									crasId:crasId,
									coverAssetId:coverAssetId,
									dispRemark:dispRemark,
									coverCrasId:coverCrasId,
								},
								success:function (res) {
									console.log(res)
									layer.closeAll()
									tableIns.reload()
								}
							})*/
                            var status = $('#status option:selected').val();
                            var scheduler=$("#scheduler").attr("user_id");
                            if($("#scheduler").val()==''){
                                $.layerMsg({content: '请填写保管人！', icon: 5});
                                return false
                            }
                            $.ajax({
                                url:'/eduFixAssets/updateEduFixAssetsModifyById',
                                type:'get',
                                data:{
                                    id:coverAssetId+',',
                                    status:status,
                                    scheduler:scheduler
                                },
                                dataType:'json',
                                success:function (res) {

                                }
                            });
                            layer.close(index);
							tableIns.reload()
                        }
					});
			}
			else if(layEvent === 'detail'){
                layer.open({
                    type: 1,
                    title: '调度详情',
                    area: ['1100px', '450px'], //宽高
                    content: '<div class="xq">'+
                        ' <table align="center" class="layui-table" style="70%">'+
                        '<thead>'+
                       '<tr>'+
                       ' <td colspan="6"><span class="big">'+data.assetsName+'历史调度信息'+'</span><span style="font-size: 10pt;">( 红色为原所属项目 , 绿色为调度后所属项目 )</span></td>'+
                   ' </tr>'+
                   ' </thead>'+
                   '<tbody class="tbody">'+
                   ' </tbody>'+
                   ' </table>'+
                    '</div>'
                    ,success:function () {
                        form.render()
                        $.ajax({
                            url: '/CpAssetDispatch/findAssetDispatchById',
                            type: 'post',
                            dataType: 'json',
                            data:{
                                coverAssetId:coverAssetId
                            },
                            success:function (res) {
                                console.log(res)
                                function checkInner(obj) {
                                    if (obj == "" || typeof (obj) == "undefined") {
                                        return " ";
                                    } else if (obj.indexOf(",")>0) {
                                        var i = obj.indexOf(",");
                                        var oldObj = obj.substr(0,i);
                                        var newObj = obj.substr(i+1);
                                        return "<span style='color: red;'>"+oldObj + "</span> --> <span style='color: green;'>" + newObj + "</span>";
                                    } else {
                                        return obj;
                                    }
                                }
                                var objStr=""
                                for (var x = 0; x < res.obj.length; x++) {
                                    objStr += "<tr>" +
                                        "<td class='tableContent' style='width: 10%;'>调度时间：</td>"+
                                        "<td class='tableData' style='width: 29%;'>"+checkInner(res.obj[x]['createTime'])+"</td>" +
                                        "<td class='tableContent'>"+"调度人："+checkInner(res.obj[x]['dispUserName'])+"</td>"+
                                        // "<td class='tableData'>"+checkInner(res.obj[x]['dispUserName'])+"</td>" +
                                        "<td class='tableContent'>"+"备注："+checkInner(res.obj[x]['dispRemark'])+"</td>" +
                                        // "<td class='tableData'>"+checkInner(res.obj[x]['dispRemark'])+"</td>" +
                                        "</tr>"+
                                        "<tr>" +
                                        "<td class='tableContent'>所属项目：</td>" +
                                        '<td class="tableData"><span style="color: red">'+res.obj[x]['crasName']+'</span>'+'-->'+'<span style="color: green">'+res.obj[x]['coverCrasName']+'<span>'+'</td>' +
                                        "<td class='tableContent'></td>" +
                                        // "<td class='tableData'>"+"</td>" +
                                        "<td class='tableContent'></td>" +
                                        // "<td class='tableData'>"+"</td>" +
                                        "</tr>" ;
                                }
                                $('.tbody').html(objStr)
                            }
                        })
                    }
                });
            }
		});
        //搜索物资功能
        $('.thingbtn').click(function () {
            var inputVal =$("input[name='material']").val()
            var infoVal =$("input[name='info']").val()
			flag1 = false
            table.reload('Settlement', {
                url: '/crash/showAssets'
                // ,methods:"post"
                , where: {
                    assetName: inputVal,
					info:infoVal
                }
            })
        });
        //搜索人员物资
        $('.peobtn').click(function () {
            var peoval =$("input[name='price_max']").val()
			flag2 = false
            table.reload('text', {
                url: '/crash/showUser'
                , where: {
                    staffName: peoval
                }
            })
        });
        //应急人员的表格
        var table2 = table.render({
            elem: '#text'
            ,url:'/crash/showUser'
            ,cols: [[
                {type: 'checkbox', fixed: 'center',width:'5%'},
                {field:'staffName', title:'姓名',width:'10%',templet:function(d){
                        // console.log(d)
                        return  '<a  class="xmming" id="'+d.userId+'" lay-event="detail">'+d.staffName+'</a>'
                    }},
                {field:'jobPositionStr', title:'岗位',width:'10%'},
                {field:'evaluate', title:'人员评价',width:'10%',templet:function(d){
					if(d.evaluate == '1'){
						return '<a href="javascript:;" style="color:red" class="userPJ" id="'+d.userId+'">优秀</a>'
					}else if(d.evaluate == '2'){
                        return '<a href="javascript:;" style="color:green" class="userPJ" id="'+d.userId+'">一般</a>'
					}else if(d.evaluate == '3'){
                        return '<a href="javascript:;" style="color:blue" class="userPJ" id="'+d.userId+'">差</a>'
					}else{
                        return '<a href="javascript:;" style="color:#666"  id="'+d.userId+'">暂无评价</a>'
					}
       			 } },
                {field:'eventName', title:'所属项目',width:'15%'},
                {field:'locationAddressName', title:'所在位置',width:'15%'},
				{fixed: 'right',title:'操作 ',width:'8%', align:'center', toolbar: '#barDemo1'}
            ]],
            done:function (res) {
                peo_data = res.data;//初始化数据;此处接收的是当前页的这10条数据
				if(yjUserList!=''){
                    for(var i=0;i<peocheck.length;i++){
                        // $('div[lay-id="text"] .layui-table .xmming[id="'+peocheck[i]+'"]').parents('tr').find('input[type="checkbox"]').prop("checked", 'checked');
                        $('.emergePerson  .layui-table .xmming[id="'+peocheck[i]+'"]').parents('tr').find('input[type="checkbox"]').prop("checked", 'checked');
                        form.render('checkbox');
                    }
				}

                if (peocheck.length > 0) {
                    for (var i = 0; i < peocheck.length; i++) {
                        for (var j = 0; j < peo_data.length; j++) {
                            if (peocheck[i] == peo_data[j].userId) {//匹配上就设为选中
                                //回显checkbox
                                // $('div[lay-filter="LAY-table-2"] .layui-table tr[data-index=' + j + '] input[type="checkbox"]').attr("checked", "checked");
                                $('.emergePerson  .layui-table tr[data-index=' + j + '] input[type="checkbox"]').attr("checked", "checked");
                                form.render('checkbox');
                            }
                        }
                    }

                }
                for(var i =0;i<res.data.length;i++){
                    staffName=res.data[i].staffName
                }
                setTimeout(function(){
                    $('th').find('.layui-form-checkbox').remove();
                },100)
                if(res.msg=='err') {
                    $('.layui-table-page').hide()
                }

                //点击右侧展开页面删除按钮x
                $(document).on("click", "#shanchu1", function () {
                    if($(this).parent().parent().find('li').length==1){
                        $(this).parent().parent().remove()
                    }else{
                        $(this).parent().remove()
                    }
                    //取消时数量改变后重新赋值
                    var litypename=$(this).parent().attr("typename");
                    var ss=$('.yjUserList  ul[tyName="'+litypename+'"]').find('b');
                    var s=$('.yjUserList  ul[tyName="'+litypename+'"]').find('li').length;
                    ss.html(s);
                    var id = $(this).parent().attr('id');
                    console.log(id)
                    removeWithoutCopy(peocheck,id)
                    // var index= $('div[lay-id="text"] .layui-table .xmming[id="'+id+'"]').parents('tr').attr('data-index')
                    var index= $('.emergePerson .layui-table .xmming[id="'+id+'"]').parents('tr').attr('data-index')
                    // console.log(index)
                    $('tr[data-index=' + index + '] input[type="checkbox"]').prop('checked', false);
                    $('tr[data-index=' + index + '] input[type="checkbox"]').next().removeClass('layui-form-checked');
                    setTimeout(function(){
                        $('th').find('.layui-form-checkbox').remove();
                    },50)

                    form.render('checkbox')
                    // console.log(peocheck)


                });
            }
            ,page: true
        });
        //点击显示全部人员
		$('.showAllPeople').click(function () {
			table2.reload({
				url: '/crash/showUser',
				where: { //设定异步数据接口的额外参数，任意设
					type:0
				},
			})
			//应急人员
			var el2 = eleTree.render({
				elem: '.ele2',
				showLine:true,
				url:'/crash/showDepts',
				lazy: true,
				load: function(data,callback) {
					$.post('/crash/showDepts?deptId='+data.id,function (res) {
						console.log(res.data)
						callback(res.data);//点击节点回调
					})
				},
				done:function (data) { //渲染完成回调
					// console.log(data)
					var aldata = data.data
					var name=data.data[0].label //传的是默认选中的值
					// pid = data.data[0].equipTypePid;
					// // getTabke(data.data[0].id);
					var dataid=$('.ele2 div').attr("data-id")
					$('.eleTree-node').removeClass('back')
					$('.ele2 div[data-id='+dataid+']').addClass('back')
					$('.eleTree-node-group').css('background','#fff')
				}
			});
			//节点点击应急人员
			var crasId2
			eleTree.on("nodeClick(data2)",function(d) {

				crasId2 = d.data.currentData.id
				$('.eleTree-node').removeClass('back')
				$(d.node[0]).addClass('back')
				$('.eleTree-node-group').css('background','#fff')
				var obj = d.data.currentData
				console.log(crasId2)
				table.reload('text', {
					url: '/crash/showUser'
					, where: {
						deptId:crasId2,
						type:0
					}
				})


			});
		})
		//点击仅显示应急人员
		$('.onlyEmergencyPerson').click(function(){
			table2.reload({
				url: '/crash/showUser',
				where: { //设定异步数据接口的额外参数，任意设
					type:1
				},
			})
			//应急人员
			var el2 = eleTree.render({
				elem: '.ele2',
				showLine:true,
				url:'/crash/showDepts',
				lazy: true,
				load: function(data,callback) {
					$.post('/crash/showDepts?deptId='+data.id,function (res) {
						console.log(res.data)
						callback(res.data);//点击节点回调
					})
				},
				done:function (data) { //渲染完成回调
					// console.log(data)
					var aldata = data.data
					var name=data.data[0].label //传的是默认选中的值
					// pid = data.data[0].equipTypePid;
					// // getTabke(data.data[0].id);
					var dataid=$('.ele2 div').attr("data-id")
					$('.eleTree-node').removeClass('back')
					$('.ele2 div[data-id='+dataid+']').addClass('back')
					$('.eleTree-node-group').css('background','#fff')
				}
			});
			//节点点击应急人员
			var crasId2
			eleTree.on("nodeClick(data2)",function(d) {

				crasId2 = d.data.currentData.id
				$('.eleTree-node').removeClass('back')
				$(d.node[0]).addClass('back')
				$('.eleTree-node-group').css('background','#fff')
				var obj = d.data.currentData
				console.log(crasId2)
				table.reload('text', {
					url: '/crash/showUser'
					, where: {
						deptId:crasId2,
						type:1
					}
				})


			});
		})
		//应急人员工具条
		table.on('tool(textFilter)', function(obj){ //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
			var data = obj.data; //获得当前行数据
			var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
			var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）
			console.log(data)
			var crasId=data.crasId
            var coverUserId=data.userId

			if(layEvent === 'edit'){
				layer.open({
					type: 1,
					btn:['确定','取消'],
					title: '调度',
					// area: ['850px', '400px'], //宽高
					area: ['850px', '400px'], //宽高
					content:'<form class="layui-form"> <div class="layui-form-item" style="margin-top:15px">\n' +
							'    <label class="layui-form-label" style="width: 89px;">被调度的人员:</label>\n' +
							'    <div class="layui-input-block">\n' +
							'      <div style="line-height: 35px;" class="renyuan" id="'+data.userId+'">'+data.staffName+'</div>' +
							'    </div>\n' +
							'  </div>' +
							'<div class="layui-form-item">'+
							'<label class="layui-form-label">岗位:</label>'+
							'<div class="layui-input-block">'+
							'<select class="gangwei" name="gangwei" lay-filter="gangwei" style="display: none">'+
							'</select>'+
							'</div>'+
							'</div>'+
							/*'<div class="layui-form-item">'+
							'<label class="layui-form-label" style="width: 107px;padding: 8px 0px;">被调度到的项目:</label>'+
							'<div class="layui-input-block">'+
							'<select class="shijian" name="shijian" lay-filter="shijian" style="display: none">'+
							'</select>'+
							'</div>'+
							'</div>'+
                        '<div class="layui-form-item layui-form-text">'+
                        '<label class="layui-form-label">备注</label>'+
                        '<div class="layui-input-block" style="width: 720px;">'+
                        '<textarea name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>'+
                        '</div>'+
                        '</div>'+*/
                        '<div class="layui-form-item">'+
                        '<label class="layui-form-label" style="width: 107px;padding: 8px 0px;">目标地点:</label>'+
                        '<div class="layui-input-block">'+
                        '<select class="location" style="display: none">'+
                        '</select>'+
                        '</div>'+
                        '</div>'+
							'</form>'
					,success:function () {
						form.render()
						//选择岗位
						$.ajax({
							url: '/hrPersonnelScheduling/getUserJob',
							type: 'post',
							dataType: 'json',
							success:function (res) {
								// console.log(res.obj)
								var data=res.obj
								var str=''
								for(var i=0;i<data.length;i++){
									str+=' <option value="'+data[i].jobId+'">'+data[i].jobName+'</option>'
								}
								$('.gangwei').html(str)
								form.render()
							}
						})
				/*		//选择被调度到的事件
						$.ajax({
							url: '/crash/showAll',
							type: 'post',
							dataType: 'json',
							success:function (res) {
								var data=res.data
								var str=''
								for(var i=0;i<data.length;i++){
									str+=' <option value="'+data[i].crasId+'">'+data[i].eventName+'</option>'
								}
								$('.shijian').html(str)
								form.render()
							}
						})*/
				        //选择目标地点
                        $.ajax({
                            type: 'get',
                            url: "/code/getCode",
                            data: {"parentNo": "LOCATION_ADDRESS"},
                            success: function (data) {
                                var str=''
                                for (var x = 0; x < data.obj.length; x++) {
                                    str+="<option id=" + data.obj[x]["codeId"] + ">" + data.obj[x]["codeName"] + "</option>"
                                }
                                $(".location").html(str)
                                form.render()
                            }
                        });
					}
					,yes:function (index) {
					/*	//保存  传被调人员和岗位
						var  coverUserId=$('.renyuan').attr('id')
						var jobPosition=$('select[name="gangwei"] :checked').val()
						$.ajax({
							url: '/hrPersonnelScheduling/insertHrShedulingLogList',
							type: 'post',
							dataType: 'json',
							data:{
								coverUserId:coverUserId,
								jobPosition:jobPosition
							},
							success:function (res) {
								console.log(res)
							}
						})*/
			/*			//保存  传被调度的人员、备注和被调度到的事件
						var  coverUserId=$('.renyuan').attr('id')   //被调度的人员
						var dispRemark=$('textarea[name="desc"]').val()  //备注
						var coverCrasId=$('select[name="shijian"] :checked').val()  //被调度到的事件
						$.ajax({
							url: '/CpAssetDispatch/insertDispatch',
							type: 'post',
							dataType: 'json',
							data:{
								dispType:1,
								crasId:crasId,
                                coverUserId:coverUserId,
								dispRemark:dispRemark,
								coverCrasId:coverCrasId,
							},
							success:function (res) {
								console.log(res)
                                layer.closeAll()
								table2.reload()
							}
						})*/
                        //保存  传人员、岗位和目标地点
                        var  coverUserId=$('.renyuan').attr('id')
                        var jobPosition=$('select[name="gangwei"] :checked').val()
                        var locationAddress= $('.location option:checked').attr('id')
                        $.ajax({
                            url: '/hrPersonnelScheduling/insertHrShedulingLogList',
                            type: 'get',
                            data: {
                                userId:coverUserId,
                                workJob:jobPosition,
                                locationAddress:locationAddress
                            },
                            dataType: 'json',
                            success: function (res) {

                            }
                        });
                        layer.close(index);
						table2.reload()
					}
				});
			}
            else if(layEvent === 'detail'){
                layer.open({
                    type: 1,
                    title: '调度详情',
                    area: ['1100px', '450px'], //宽高
                    content: '<div class="xq">'+
                        ' <table align="center" class="layui-table" style="70%">'+
                        '<thead>'+
                        '<tr>'+
                        ' <td colspan="6"><span class="big">'+data.staffName+'历史调度信息'+'</span><span style="font-size: 10pt;">( 红色为原所属项目 , 绿色为调度后所属项目 )</span></td>'+
                        ' </tr>'+
                        ' </thead>'+
                        '<tbody class="tbody">'+
                        ' </tbody>'+
                        ' </table>'+
                        '</div>'
                    ,success:function () {
                        form.render()
                        $.ajax({
                            url: '/CpAssetDispatch/findAssetDispatchById',
                            type: 'post',
                            dataType: 'json',
                            data:{
                                coverUserId:coverUserId
                            },
                            success:function (res) {
                                console.log(res)
                                function checkInner(obj) {
                                    if (obj == "" || typeof (obj) == "undefined") {
                                        return " ";
                                    } else if (obj.indexOf(",")>0) {
                                        var i = obj.indexOf(",");
                                        var oldObj = obj.substr(0,i);
                                        var newObj = obj.substr(i+1);
                                        return "<span style='color: red;'>"+oldObj + "</span> --> <span style='color: green;'>" + newObj + "</span>";
                                    } else {
                                        return obj;
                                    }
                                }
                                var objStr=""
                                for (var x = 0; x < res.obj.length; x++) {
                                    objStr += "<tr>" +
                                        "<td class='tableContent' style='width: 10%;'>调度时间：</td>"+
                                        "<td class='tableData' style='width:29%'>"+checkInner(res.obj[x]['createTime'])+"</td>" +
                                        "<td class='tableContent'>"+"调度人："+checkInner(res.obj[x]['dispUserName'])+"</td>"+
                                        // "<td class='tableData'>"+checkInner(res.obj[x]['dispUserName'])+"</td>" +
                                        "<td class='tableContent'>"+"备注："+checkInner(res.obj[x]['dispRemark'])+"</td>" +
                                        // "<td class='tableData'>"+checkInner(res.obj[x]['dispRemark'])+"</td>" +
                                        "</tr>"+
                                        "<tr>" +
                                        "<td class='tableContent'>所属项目：</td>" +
                                        '<td class="tableData"><span style="color: red">'+res.obj[x]['crasName']+'</span>'+'-->'+'<span style="color: green">'+res.obj[x]['coverCrasName']+'<span>'+'</td>' +
                                        "<td class='tableContent'></td>" +
                                        "<td class='tableContent'></td>" +
                                        "</tr>" ;
                                }
                                $('.tbody').html(objStr)
                            }
                        })
                    }
                });
            }
		});
        function evLevelName(data) {
            var evLevel = data.evLevel;
            if (evLevel == 1) {
                return "优秀";
            }else if(evLevel == 2){
                return "一般 ";
            }else if(evLevel == 3){
                return "黑名单";
            }else {
                return "";
            }
        }
        //点击人员评价
        $(document).on('click','.userPJ',function(){
            var id=$(this).attr('id');
            var data={
                userId:id
            }
            $.ajax({
                url: '/hrEvaluate/selectByUserId',
                type: 'post',
                dataType: 'json',
                data:data,
                success: function (res) {
                    layer.open({
                        type: 1,
                        closeBtn: 1,
                        title: '历次评价',
                        area: ['850px', '400px'], //宽高
                        content: '<form class="layui-form" action=""> ' +function () {
                            var str='';
                            for(var i=0;i<res.data.length;i++) {
                                str += '<table class="layui-table" style="width: 98%!important;text-align: center;margin-bottom: 40px;border: 1px black double;">' +
                                    '  <tbody num='+res.data.length+'>' +
                                    '    <tr>' +
									'<td style="width:15%">综合评价</td><td><div >'+evLevelName(res.data[i])+'</div> </td>' +
                                    '      <td style="width:15%">工作技能</td>' +
                                    '      <td><div id="skill'+res.data[i].evId+'"></div></td>' +
                                    '    </tr>' +
                                    '    <tr>' +
                                    '      <td>所在项目</td>' +
                                    '      <td><div>' + res.data[i].project + '</div> </td>' +
                                    '      <td>工作态度</td>' +
                                    '      <td><div id="attitude'+res.data[i].evId+'"></div></td>' +
                                    '    </tr>' +
                                    '    <tr>' +
                                    '      <td>详细评价</td>' +
                                    '      <td colspan="3"><div>' + res.data[i].evDetail + '</div></td>' +
                                    '    </tr>' +
                                    '    <tr>' +
                                    '      <td>评价人</td>' +
                                    '      <td><div>' +function () {
                                        if( res.data[i].evUserName==undefined){
                                            return ''
                                        }else{
                                            return res.data[i].evUserName
                                        }
                                    }() + '</div> </td>' +
                                    '      <td>时间</td>' +
                                    '      <td><div>' +res.data[i].evTime.slice(0,-2)+'</div> </td>' +
                                    '    </tr>' +
                                    '  </tbody>' +
                                    '</table>'


//
                            }
                            return str;
                        }()+'</form>'
                        ,success:function () {

                            var data = res.data;//返回的json中data数据
                            for (var item in data) {
//                            //渲染
                                rate.render({
                                    elem: '#skill' + data[item].evId + ''   //绑定元素
                                    , half: true //开启半星
                                    , value: data[item].evSkill / 2
                                    ,readonly: true
                                });
                                rate.render({
                                    elem: '#attitude' + data[item].evId + ''  //绑定元素
                                    , half: true //开启半星
                                    , value:  data[item].evAttitude / 2
                                    ,readonly: true
                                });
                            }
                        }
                    });
                }
            })
		})
		//点击分组查询
        $("#groupss").click(function(){
            flag1=false
            el = eleTree.render({
                elem: '.ele1',
                showLine:true,
                url:'/assetGroup/selectAllBaseInfo',
                lazy: true,
                done:function (data) { //渲染完成回调
                    var aldata = data.data
                    var name=data.data[0].name //传的是默认选中的值
                    var pid = data.data[0].equipTypePid;
                    // getTabke(data.data[0].id);
                    var dataid=$('.ele1 div').attr("data-id")
                    $('.eleTree-node').removeClass('back')
                    $('.ele1 div[data-id='+dataid+']').addClass('back')
                    $('.eleTree-node-group').css('background','#fff')
                }
            });
            var crasId
            eleTree.on("nodeClick(data1)",function(d) {
                crasId = d.data.currentData.groupId
                var dataid=$('.ele1 div').attr("data-id")
                var a = d.data.currentData.id;
                $('.eleTree-node').removeClass('back')
                $(d.node[0]).addClass('back')
                $('.eleTree-node-group').css('background','#fff')
                var obj = d.data.currentData
                var name = obj.name
                var pid = obj.equipTypePid;
                var idkey = obj.id;
                table.reload('Settlement',{
                    url : '/assetGroup/selectById?type=1&groupId='+ obj.groupId,
                })
            });
        })
        // 初始化渲染 应急设备树形菜单
        el = eleTree.render({
            elem: '.ele1',
            showLine:true,
            url:'/cpAssetsType/showYjType',
            lazy: true,
            load: function(data,callback) {
                $.post('/cpAssetsType/showChild?parentId='+data.typeId,function (res) {
                    callback(res.data);//点击节点回调
                })
            },
            done:function (data) { //渲染完成回调
                var aldata = data.data
                var name=data.data[0].name //传的是默认选中的值
                var pid = data.data[0].equipTypePid;
                // getTabke(data.data[0].id);
                var dataid=$('.ele1 div').attr("data-id")
                $('.eleTree-node').removeClass('back')
                $('.ele1 div[data-id='+dataid+']').addClass('back')
                $('.eleTree-node-group').css('background','#fff')
            }
        });
        // 节点点击事件设备
        var crasId
        eleTree.on("nodeClick(data1)",function(d) {
            crasId = d.data.currentData.typeId
            var dataid=$('.ele1 div').attr("data-id")
            var a = d.data.currentData.id;
            $('.eleTree-node').removeClass('back')
            $(d.node[0]).addClass('back')
            $('.eleTree-node-group').css('background','#fff')
            var obj = d.data.currentData
            var name = obj.name
            var pid = obj.equipTypePid;
            var idkey = obj.id;
            var currentPage = 1
            table.reload('Settlement',{
                url : '/crash/showAssets?typeId='+ obj.typeId,

            })

        });
        //应急人员
        var el2 = eleTree.render({
            elem: '.ele2',
            showLine:true,
            url:'/crash/showDepts',
            lazy: true,
            load: function(data,callback) {
                $.post('/crash/showDepts?deptId='+data.id,function (res) {
                    console.log(res.data)
                    callback(res.data);//点击节点回调
                })
            },
            done:function (data) { //渲染完成回调
                // console.log(data)
                var aldata = data.data
                var name=data.data[0].label //传的是默认选中的值
                // pid = data.data[0].equipTypePid;
                // // getTabke(data.data[0].id);
                var dataid=$('.ele2 div').attr("data-id")
                $('.eleTree-node').removeClass('back')
                $('.ele2 div[data-id='+dataid+']').addClass('back')
                $('.eleTree-node-group').css('background','#fff')
            }
        });
        //节点点击应急人员
        var crasId2
        eleTree.on("nodeClick(data2)",function(d) {

            crasId2 = d.data.currentData.id
            $('.eleTree-node').removeClass('back')
            $(d.node[0]).addClass('back')
            $('.eleTree-node-group').css('background','#fff')
            var obj = d.data.currentData
			console.log(crasId2)
            table.reload('text', {
                url: '/crash/showUser'
                , where: {
                    deptId:crasId2
                }
            })


        });
        //监听应急设备的表格的复选框
        table.on('checkbox(SettlementFilter)', function(obj){
            var ischeck=obj.checked;
            var data= obj.data;
            console.log(data)
            var type =obj.type;
			flag1 = true;
            if (type=='one'){
            	//选中复选框
                if (ischeck) {
                    checktab.push(data.id);  //如果是选中的就把选中的id值checktab的数据上
                    checktabName.push(data.assetsName);
                    var tjsb=''
					//判断往右侧页面新增所选数据，右侧有设备类别就直接添加子集，没有就添加设备类别和子集
                    if(data.typeName!==$('.shebeiList ul[tyName="'+data.typeName+'"]').attr('tyName')){
						tjsb+='<ul tyName="'+data.typeName+'"><span>'+data.typeName+':'+'</span><b></b>' +
								'<li id="'+data.id+'" typeName="'+data.typeName+'">'+data.assetsName+
								'<i  id="shanchu" class="layui-icon layui-icon-close" style="font-size: 18px; color:red;margin-left: 6px;"></i>' +
								'</li>'+
								'</ul>'
						$('.shebeiList').append(tjsb)
						/*var tt=$('.shebeiList  ul[tyName="'+data.typeName+'"]').find('b')
						var shuliang1=$('.shebeiList ul[tyName="'+data.typeName+'"]').find('li').length*/

					}else {
						var li= '<li id="'+data.id+'" typeName="'+data.typeName+'">'+data.assetsName+
								'<i id="shanchu" class="layui-icon layui-icon-close" style="font-size: 18px; color:red;margin-left: 6px;"></i>' +
								'</li>';
						$('.shebeiList ul[tyName="'+data.typeName+'"]').append(li)
						/*var ss=$('.shebeiList  ul[tyName="'+data.typeName+'"]').find('b')
						var shuliang=$('.shebeiList ul[tyName="'+data.typeName+'"]').find('li').length*/

					}

					var ss=$('.shebeiList  ul[tyName="'+data.typeName+'"]').find('b')
					var shuliang=$('.shebeiList ul[tyName="'+data.typeName+'"]').find('li').length;
					ss.html(shuliang)
                }
                //取消复选框
                else {
					if($('.shebeiList ul[tyName="'+data.typeName+'"]').find('li').length==1){
						$('.shebeiList ul[tyName="'+data.typeName+'"]').remove()
					}
					//取消时数量改变后重新赋值
					var yy=$('.shebeiList  ul[tyName="'+data.typeName+'"]').find('b')
					var shuliangy=$('.shebeiList ul[tyName="'+data.typeName+'"]').find('li').length-1
					yy.html(shuliangy)
                    removeWithoutCopy(checktab,data.id);
                    removeWithoutCopyName(checktabName,data.assetsName);
                }
            } else if(type == 'all'){
                var datas = table.checkStatus('Settlement').data;
                if(ischeck){
                    for(var i=0,length=datas.length;i<length;i++){
                        checktab.push(datas[i].id);
                    }
				} else {
                    datas = table.cache.Settlement;
                    for(var i=0,length=datas.length;i<length;i++){
                        removeWithoutCopy(checktab,datas[i].id);
                    }
				}
			}
            $('th').find('.layui-form-checkbox').remove();
            // console.log(checktab)
            // console.log(checktabName)
        });
        //监听应急人员设备的复选框
        table.on('checkbox(textFilter)', function(obj){

            var ischeck1=obj.checked;
            var data1= obj.data;
            var type1 =obj.type;
            console.log(data1)
			flag2 = true;
            if (type1=='one') {
                if (ischeck1) {
                    peocheck.push(data1.userId);  //如果是选中的就把选中的id值checktab的数据上
                    peocheckName.push(data1.staffName);
                    // var li='<li id="'+data1.userId+'">'+data1.staffName+'</li>';
                    // $('.yjUserList').append(li)

					var tjsb=''
					//判断往右侧页面新增所选数据，右侧有设备类别就直接添加子集，没有就添加设备类别和子集
					if(data1.jobPositionStr!==$('.yjUserList ul[tyName="'+data1.jobPositionStr+'"]').attr('tyName')){
						tjsb+='<ul tyName="'+data1.jobPositionStr+'"><span>'+data1.jobPositionStr+':'+'</span><b></b>' +
								'<li id="'+data1.userId+'" typeName="'+data1.jobPositionStr+'">'+data1.staffName+
								'<i  id="shanchu1" class="layui-icon layui-icon-close" style="font-size: 18px; color:red;margin-left: 6px;"></i>' +
								'</li>'+
								'</ul>'
						$('.yjUserList').append(tjsb)

					}else {
						var li= '<li id="'+data1.userId+'" typeName="'+data1.jobPositionStr+'">'+data1.staffName+
								'<i id="shanchu1" class="layui-icon layui-icon-close" style="font-size: 18px; color:red;margin-left: 6px;"></i>' +
								'</li>';
						$('.yjUserList ul[tyName="'+data1.jobPositionStr+'"]').append(li)

					}

					var ss=$('.yjUserList  ul[tyName="'+data1.jobPositionStr+'"]').find('b')
					var shuliang=$('.yjUserList ul[tyName="'+data1.jobPositionStr+'"]').find('li').length;
					ss.html(shuliang)

                } else {

					if($('.yjUserList ul[tyName="'+data1.jobPositionStr+'"]').find('li').length==1){
						$('.yjUserList ul[tyName="'+data1.jobPositionStr+'"]').remove()
					}
					//取消时数量改变后重新赋值
					var yy=$('.yjUserList  ul[tyName="'+data1.jobPositionStr+'"]').find('b')
					var shuliangy=$('.yjUserList ul[tyName="'+data1.jobPositionStr+'"]').find('li').length-1
					yy.html(shuliangy)
                    removeWithoutCopy(peocheck, data1.userId);
                    removeWithoutCopyName(peocheckName, data1.staffName);
                }
            } else if(type1 == 'all'){
                var datas = table.checkStatus('usersTable').data;
                if(ischeck1){
                    for(var i=0,length=datas.length;i<length;i++){
                        peocheck.push(datas[i].userId);
                    }
                } else {
                    datas = table.cache.usersTable;
                    for(var i=0,length=datas.length;i<length;i++){
                        removeWithoutCopy(peocheck,datas[i].userId);
                    }
                }
            }
            $('th').find('.layui-form-checkbox').remove();
            // console.log(peocheck)
            // console.log(peocheckName)
        });
        //移除数组 arr 中的所有值与 item 相等的元素，直接在给定的 arr 数组上进行操作，并将结果返回
        function removeWithoutCopy(arr, item) {
            var num = arr.length;
            for(var i = 0; i < num; i++){

                if(arr[i] == item ){
                    arr.splice(i,1);
                    $('.fixRight').find('li[id="'+item+'"]').remove();
                    // arr.push(arr.shift());
                // }else{
                //     arr.shift();
                }
            }
            return arr;
        }
        function removeWithoutCopyName(arr, item) {
            var num = arr.length;
            for(var i = 0; i < num; i++){
                if(arr[i] == item ){
                    arr.splice(i,1);
                }
            }
            return arr;
        }
        //点击保存的事件
        $('.save').click(function(){
            //var checktype = table.checkStatus("Settlement").data;
            var checkpeo = peocheck;
            var ids = "";
            var userids = ""
            // for(var i=0;i<checktab.length;i++){
            //     ids += checktab[i] + ','
            // }
			for(var i=0;i<$('.shebeiList li').length;i++){
                ids += $('.shebeiList li').eq(i).attr('id')+','
			}
            for(var i=0;i<checkpeo.length;i++){
                userids += checkpeo[i] + ','
            }

            var param={
                crasId:paent.crasId,
                rescueEquipment:ids,
                // rescuePersons:''
            }
            layer.open({
				type:1,
				title:'已选设备信息',
				area:['400px','80%'],
				btn:['确定','取消'],
				content:'<div style="width:100%;height:100%;"><div class="treeTitle" style="width:100%">已选设备</div><ul class="sbList" style="min-height: 100px"></ul></div>',
				success:function(){

						$('.sbList').html($('.shebeiList').html())

				},
				yes:function(){
                    $.ajax({
                        url:'/crash/change',
                        type:'post',
                        data:param,
                        dataType:'json',
                        success:function (res) {
                            // parent.closex();
							layer.closeAll();
                        }
                    })
				}
			})

        })
        //点击保存的事件
        $('.save2').click(function(){
            //var checktype = table.checkStatus("Settlement").data;
            var checkpeo = peocheck;
            var ids = "";
            var userids = ""
            for(var i=0;i<checktab.length;i++){
                ids += checktab[i] + ','
            }
            // for(var i=0;i<checkpeo.length;i++){
            //     userids += checkpeo[i] + ','
            // }
            for(var i=0;i<$('.yjUserList li').length;i++){
                userids += $('.yjUserList li').eq(i).attr('id') + ','
            }

            var param={
                crasId:paent.crasId,
                // rescueEquipment:'',
                rescuePersons:userids
            }
            layer.open({
                type:1,
                title:'已选人员信息',
                area:['400px','80%'],
                btn:['确定','取消'],
                content:'<div style="width:100%;height:100%;"><div class="treeTitle" style="width:100%">已选人员</div><ul class="yjList" style="min-height: 100px"></ul></div>',
                success:function(){

                        $('.yjList').html($('.yjUserList').html())

                },
                yes:function(){
                    $.ajax({
                        url:'/crash/change',
                        type:'post',
                        data:param,
                        dataType:'json',
                        success:function (res) {
                            // parent.closex();
							layer.closeAll();
                        }
                    })
                }
            })

        })
		//点击tab 设备类别
        $("#equip").click(function(){
            // window.location.reload()
			flag1=false
            var tableIns=table.render({
                elem: '#Settlement',
                url:'/crash/showAssets',
                cols: [[
					{type: 'checkbox', fixed: 'left',width:'5%'} //totalRowText:'合计'
					,{field:'assetsName', title:'设备名称 ',width:'10%',templet:function(d){
							return  '<a  class="sbming" id="'+d.id+'" lay-event="detail">'+d.assetsName+'</a>'
						} }
					,{field:'info', title:'型号 ',width:'10%'}
					,{field:'number', title:'数量',width:'6.5%' }
					,{field:'typeName', title:'设备类别',width:'9.5%'}
					,{field:'eventName', title:'所属项目',width:'10%'}
					,{field:'deptName', title:'所属部门',width:'10%' }
					,{field:'currutLocation', title:'所在位置',width:'10%'}
					,{field:'status', title:'设备状况 ',width:'10%',templet:function(d){
							if(d.status == '1'){
								return '未使用'
							}else if(d.status == '2'){
								return '使用'
							}else if(d.status == '3'){
								return '损坏'
							}else if(d.status == '4'){
								return '丢失'
							}else{
								return '报废'
							}
						} }
					,{fixed: 'right',title:'操作 ', width:'8%', align:'center', toolbar: '#barDemo'}
                ]],
                page: true,
                done:function (res) {

                    table_data = res.data;//初始化数据;此处接收的是当前页的这10条数据
                    if(shebeiList!=''){
                        var arr = shebeiList.split(',');
                        console.log(arr)
                        var arrtwo = shebeiNameList.split(',')
                        for (var m = 0; m < table_data.length; m++) {
                            for (var n = 0; n < arr.length; n++) {
                                if (table_data[m].id == arr[n]) {//匹配上就设为选中
                                    if(flag1){
                                        checktab.push(arr[n])
                                        checktabName.push(table_data[m].assetsName)
                                    }

                                    //回显checkbox
                                    $('div[lay-id="Settlement"] .layui-table tr[data-index=' + m + '] input[type="checkbox"]').attr("checked", "checked");
                                    form.render('checkbox');

                                }
                            }
                        }
                    }
                    if (checktab.length > 0) {
                        for (var i = 0; i < checktab.length; i++) {
                            for (var j = 0; j < table_data.length; j++) {
                                if (checktab[i] == table_data[j].id) {//匹配上就设为选中
                                    //回显checkbox
                                    $('div[lay-filter="LAY-table-1"] .layui-table tr[data-index=' + j + '] input[type="checkbox"]').attr("checked", "checked");
                                    $('th').find('.layui-form-checkbox').remove();
                                    form.render('checkbox');

                                }
                            }
                        }
                    }


                    if(res.msg=='无数据'){
                        $('.layui-table-page').hide()
                    }

                    setTimeout(function(){
                        $('th').find('.layui-form-checkbox').remove();
                    },100)

                    // $('.layui-table-header').find('th').eq(0).find('input[type="checkbox"]').remove()
                    form.render();
                }
            });
            eleTree.render({
                elem: '.ele1',
                showLine:true,
                url:'/cpAssetsType/showYjType',
                lazy: true,
                load: function(data,callback) {
                    $.post('/cpAssetsType/showChild?parentId='+data.typeId,function (res) {
                        callback(res.data);//点击节点回调
                    })
                },
                done:function (data) { //渲染完成回调
                    aldata = data.data
                    var name=data.data[0].name //传的是默认选中的值
                    pid = data.data[0].equipTypePid;
                    // getTabke(data.data[0].id);
                    var dataid=$('.ele1 div').attr("data-id")
                    $('.eleTree-node').removeClass('back')
                    $('.ele1 div[data-id='+dataid+']').addClass('back')
                    $('.eleTree-node-group').css('background','#fff')
                }
            });
            var crasId=''
            eleTree.on("nodeClick(data1)",function(d) {
                crasId = d.data.currentData.typeId
                var dataid=$('.ele1 div').attr("data-id")
                var a = d.data.currentData.id;
                $('.eleTree-node').removeClass('back')
                $(d.node[0]).addClass('back')
                $('.eleTree-node-group').css('background','#fff')
                var obj = d.data.currentData
               var  name = obj.name
                pid = obj.equipTypePid;
                idkey = obj.id;
                var currentPage = 1
                table.reload('Settlement',{
                    url : '/crash/showAssets?typeId='+ obj.typeId,

                })

            });
        });
    });
    //点击回车搜索物资
    $('.wuInp').on('keypress',function(evevt){
        if (event.keyCode == 13) {
            //阻止事件冒泡
            event.preventDefault();
            $('.thingbtn').trigger('click');
        }
    });
    //点击回车搜索人员
    $('.personInp').on('keypress',function(evevt){
        if (event.keyCode == 13) {
            //阻止事件冒泡
            event.preventDefault();
            $('.peobtn').trigger('click');
        }
    });
    $('.people .layui-table-page').addClass('pertab')
	//数组去重
	function unique(arr) {
		if (!Array.isArray(arr)) {
			console.log('type error!')
			return
		}
		var array =[];
		for(var i = 0; i < arr.length; i++) {
			if( !array.includes( arr[i]) ) {//includes 检测数组是否有某个值
				array.push(arr[i]);
			}
		}
		return array
	}
	//点击新增设备
	$('.addEquipment').click(function(){
		window.open('/eduFixAssets/fixAssetsEdit?editFlag=0&id=0')
	})
</script>
</body>



</html>